package com.zgkxzx.算法;

import com.zgkxzx.算法.斐波那契数列.Fibonacci;

/**
 * 创建者   zgkxzx
 * 创建日期 2018/5/12.
 * 功能描述
 */
public class AgloTest {
    public static  void test(){
        fibonacciTest();
    }

    private static void fibonacciTest() {
        for (int i = 0; i < 5; i++) {
            int result = Fibonacci.calc1(i);
            System.out.println("i = " + i + " --> " + result);
        }

        for (int i = 0; i < 5; i++) {
            int result = Fibonacci.calc2(i);
            System.out.println("i = " + i + " --> " + result);
        }

    }

    private static int 最大公约数(int number1, int number2) {
        if (number1 == 0 || number2 == 0)
            return 0;
        int num;
        do {
            num = number1 % number2;
            if (num != 0) {
                number1 = number2;
                number2 = num;
            }

        } while (num != 0);
        return number2;
    }

    private static int 最小公倍数(int number1, int number2) {
        return number1 * number2 / 最大公约数(number1, number2);
    }
}
